package com.ggb.smartstudy.entity;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;

import java.sql.Timestamp;

/**
 * @author gefangjie
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    @NonNull
    private Integer id;

    @NotBlank(message = "用户名不能为空")
    @Size(max = 20, message = "用户名长度不能超过20个字符")
    private String username;

    @NotBlank(message = "昵称不能为空")
    @Size(max = 255, message = "昵称长度不能超过255个字符")
    private String nickname;

    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 18, message = "密码长度应在6到18个字符之间")
    private String password;

    @NotBlank(message = "电子邮箱不能为空")
    @Email(message = "电子邮箱格式不正确")
    @Size(max = 30, message = "电子邮箱长度不能超过30个字符")
    private String email;

    private Timestamp createTime;
    private Timestamp updateTime;
}

